/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.unisinos.pgr.graub;

/**
 *
 * @author Douglas
 */
public class Camera {

    private float dx;
    private float dy;
    private float dz;
    private float ang;
    private float eyey;
    private float eyex;
    private float eyez;
    public static final float dd = 1;
    public static final float per = 0.05f;

    public Camera() {
        ang = 0.0f;
        dx = -9.0f;
        dy = 0.0f;
        dz = 0.0f;
        eyex = -10.0f;
        eyey = 0.0f;
        eyez = 0.0f;
    }

    public Camera(float dx, float dy, float dz, float ang, float eyex, float eyey, float eyez) {
        this.dx = dx;
        this.eyey = eyey;
        this.dy = dy;
        this.dz = dz;
        this.ang = ang;
        this.eyex = eyex;
        this.eyez = eyez;
    }

    /**
     * @return the dx
     */
    public float getDx() {
        return dx;
    }

    /**
     * @param dx the dx to set
     */
    public void setDx(float dx) {
        this.dx = dx;
    }

    /**
     * @return the dz
     */
    public float getDz() {
        return dz;
    }

    /**
     * @param dz the dz to set
     */
    public void setDz(float dz) {
        this.dz = dz;
    }

    /**
     * @return the ang
     */
    public float getAng() {
        return ang;
    }

    /**
     * @param ang the ang to set
     */
    public void setAng(float ang) {
        this.ang = ang;
    }

    /**
     * @return the eyex
     */
    public float getEyex() {
        return eyex;
    }

    /**
     * @param eyex the eyex to set
     */
    public void setEyex(float eyex) {
        this.eyex = eyex;
    }

    /**
     * @return the eyez
     */
    public float getEyez() {
        return eyez;
    }

    /**
     * @param eyez the eyez to set
     */
    public void setEyez(float eyez) {
        this.eyez = eyez;
    }

    public void rotatedir() {
        ang += dd;
        if (ang > 359) {
            ang = 0;
        }
        dx = (float) (eyex + (Math.cos(ang / 180 * Math.PI)));
        dz = (float) (eyez + (Math.sin(ang / 180 * Math.PI)));
    }

    public void rotateesq() {
        ang -= dd;
        if (ang < 0) {
            ang = 359;
        }
        dx = (float) (eyex + (Math.cos(ang / 180 * Math.PI)));
        dz = (float) (eyez + (Math.sin(ang / 180 * Math.PI)));
    }

    public void andar_frente() {
        float ddx = (float) ((Math.cos(ang / 180 * Math.PI)) * per);
        float ddz = (float) ((Math.sin(ang / 180 * Math.PI)) * per);

        eyex += ddx;
        eyez += ddz;
        dx += ddx;
        dz += ddz;
    }

    public void andar_tras() {
        float ddx = (float) ((Math.cos(ang / 180 * Math.PI)) * per);
        float ddz = (float) ((Math.sin(ang / 180 * Math.PI)) * per);

        eyex -= ddx;
        eyez -= ddz;
        dx -= ddx;
        dz -= ddz;
    }

    /**
     * @return the dy
     */
    public float getDy() {
        return dy;
    }

    /**
     * @param dy the dy to set
     */
    public void setDy(float dy) {
        this.dy = dy;
    }

    /**
     * @return the eyey
     */
    public float getEyey() {
        return eyey;
    }

    /**
     * @param eyey the eyey to set
     */
    public void setEyey(float eyey) {
        this.eyey = eyey;
    }
}
